﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/AdminMasterPage.master" AutoEventWireup="true" CodeFile="subpage_access.aspx.cs" Inherits="admin_user_subpage_access" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="contents">
        <table width="100%" cellpadding="3" cellspacing="0" border="0">
            <tr>
                <td colspan="2">
                    <h1>Sub Pages User Access</h1>
                </td>
            </tr>
            <tr>
                <td>
                    <b>Provider</b> :
                    <asp:DropDownList ID="ddlProviderCompany" runat="server" AutoPostBack="true" onselectedindexchanged="ddlProviderCompany_SelectedIndexChanged">
                        <asp:ListItem Selected="True" Value="0">Select</asp:ListItem>
                        <asp:ListItem Value="11">AZCp Insurance</asp:ListItem>
                        <asp:ListItem Value="12">MSIG Insurance</asp:ListItem>
                        <asp:ListItem Value="29">LMG Insurance</asp:ListItem>                        
                        <asp:ListItem Value="31">Chartis Insurance</asp:ListItem>
                        <asp:ListItem Value="32">Bangkok Insurance</asp:ListItem>
                    </asp:DropDownList>&nbsp;
                    <b>Main Page</b> :
                    <asp:DropDownList ID="ddlMainPage" runat="server" AutoPostBack="true" onselectedindexchanged="ddlMainPage_SelectedIndexChanged">
                        <asp:ListItem Selected="True" Value="0">None</asp:ListItem>
                    </asp:DropDownList>&nbsp;
                    <b>User</b> :
                    <asp:DropDownList ID="ddlUser" runat="server" AutoPostBack="true" onselectedindexchanged="ddlUser_SelectedIndexChanged">
                        <asp:ListItem Selected="True" Value="0">None</asp:ListItem>
                    </asp:DropDownList> 
                </td>
                <td width="30%" align="right" style="text-align:right;"></td>
            </tr>
             <tr>
                <td colspan="2">
                    <asp:GridView ID="grvUserAccess" runat="server" AllowPaging="False" AllowSorting="True"
                        AutoGenerateColumns="False" Cellspacing="3" CellPadding="3" Width="60%" DataKeyNames="MainPageId" DataSourceID="sqlDsSubPages"
                        EmptyDataText="There are no data records to display." CssClass="admin_gridstyle" PagerStyle-CssClass="pgr" 
                        GridLines="None" onrowdatabound="grvUserAccess_RowDataBound">
                        <Columns>
                            <asp:TemplateField HeaderText="MainPageId" Visible="false">
                                <ItemTemplate>
                                        <asp:Label ID="lblMainPageId" runat="server" Text='<%# Eval("MainPageId").ToString()%>'></asp:Label> 
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="SubPageId" Visible="false">
                                <ItemTemplate>
                                        <asp:Label ID="lblSubPageId" runat="server" Text='<%# Eval("SubPageId").ToString()%>'></asp:Label> 
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="ProviderCompanyId" Visible="false">
                                <ItemTemplate>
                                        <asp:Label ID="lblProviderCompanyId" runat="server" Text='<%# Eval("ProviderCompanyId").ToString()%>'></asp:Label> 
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="ProviderSubPageName" HeaderText="Page Name" ItemStyle-Width="400px" />
                            <asp:BoundField DataField="CXSubPageName" HeaderText="Page Name" Visible="false" />
                            <asp:TemplateField HeaderText="User Access">
                                <ItemTemplate>
                                         <asp:DropDownList ID="ddlUserAccess" runat="server">
                                            <asp:ListItem Value="0">Not Accessible</asp:ListItem>
                                            <asp:ListItem Value="100">View</asp:ListItem>
                                            <asp:ListItem Value="200">View/Update</asp:ListItem>
                                            <asp:ListItem Value="300">View/Update/Delete</asp:ListItem>
                                         </asp:DropDownList>
                                </ItemTemplate>
                            </asp:TemplateField> 
                        </Columns>
                        <FooterStyle />
                        <PagerStyle />
                        <SelectedRowStyle />
                        <HeaderStyle CssClass="admin_gridheader" />
                        <EditRowStyle />
                        <AlternatingRowStyle CssClass="admin_gridodd" />
                        <RowStyle CssClass="admin_grideven" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="sqlDsSubPages" runat="server" ConnectionString="<%$ ConnectionStrings:TH.CX_DBConnectionString %>"
                        SelectCommand="sprocProviderSubPagesSelectItemList" SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="ddlProviderCompany" Name="ProviderCompanyId" PropertyName="SelectedValue" Type="Int64" />
                            <asp:ControlParameter ControlID="ddlMainPage" Name="MainPageId" PropertyName="SelectedValue" Type="Int64" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="btnSave" runat="server" Text="Submit" OnClick="btnSave_Click" />
                </td>
                <td width="25%" align="right" style="text-align:right;"></td>
            </tr>
        </table>
    </div>
</asp:Content>

